package com.hn.dao;

import com.hn.mapper.UserMapper;
import com.hn.pojo.User;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @作者 : wangchangdian444
 * @创建时间 : 2019/3/22 - 9:16
 */

@Repository("userDao")
public class UserDao {
    //@Autowired
    @Resource
    UserMapper userMapper;


    //根据name查用户
    public List<User> findNameByUser(String userName){
        return userMapper.findNameByUser(userName);
    }

    //根据id或userName删除用户
    public void deleteUserById(String userName,int id){
        userMapper.deleteUserById(userName,id);
    }

    //增加用户
   public void addUser(User user){
       userMapper.addUser(user);
   }

   //修改用户
    public void updateUser(User user){
        userMapper.updateUser(user);

    }

    //根据id查询一个用户
    public User findOneByIdUser(int id){
        return userMapper.findOneByIdUser(id);
    }
}